package com.algorithm;

public class DebugMain {

    public static void main(String[] args) {

        dfs(0, 3);

    }

    static int count = 0;

    static int dfs(int low, int high) {

        printIndent(count++);
        System.out.println("i="+low+";j="+high);
        if(low>=high){
            printIndent(--count);
            System.out.println("return "+low);
            return low;
        }
        int mid=(low+high)/2;
        int left=dfs(low,mid-1);
        int right=dfs(mid+1,high);
        printIndent(--count);
        System.out.println("return "+(left+right));
        return left+right;
    }

    static void printIndent(int count) {

        for (int i = 0; i < count; i++) {
            System.out.print(" ");
        }

    }
}
